import h from './mysnabbdom/h';
import patch from './mysnabbdom/patch'

const container = document.getElementById('container');
const btn = document.getElementById('btn');

const vnode1 = h('ul', {}, [
  h('li', {key: 'a'}, 'aaa'), 
  h('li', {key: 'b'}, 'bbb'),
  h('li', {key: 'qq'}, 'bqqqqqqqqbb'),
  h('li', {key: 'c'}, 'ccc'),
  h('li', {key: 'pp'}, 'ppppp'),
]);

// const newVnode = h('ul', {}, '我变成ul了');
const newVnode = h('ul', {}, [
  h('li', {key: 'a'}, 'aaa'),
  h('li', {key: 'b'}, 'bbb'),
  h('li', {key: 'c'}, 'ccc'),
  h('li', {key: 'y'}, 'asfsfsfsdfs'),
  h('li', {key: 'q'}, [h('p', {}, 'dasdf'),h('p', {}, 'fgfd'),h('p', {}, 'vdfxgv')]),
  h('li', {key: 'n'}, 'nnn'),
  // h('li', {key: 'c'}, 'ccc'),
  h('li', {key: 'p'}, 'ppp'),
]);


// 上树
patch(container, vnode1)

btn.onclick = () => {
  patch(vnode1, newVnode)
}
